import 'package:flutter/material.dart';

main(List<String> args) {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(primaryColor: Colors.blueAccent),
      home: Scaffold(
        appBar: AppBar(title: Text("首页"),backgroundColor: Colors.green,),
        body: HomeContent(),
      ),
    );
  }
}

class HomeContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(8.0),
      child: ListView(
        children: <Widget>[
           ProductWidget(
            "MacBook",
            "MacBook详细描述",
            "https://img0.baidu.com/it/u=4146151895,3161377460&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=830",
          ),
          ProductWidget(
            "IMac",
            "IMac详细描述",
            "https://img0.baidu.com/it/u=2077678719,3178805004&fm=253&fmt=auto&app=138&f=JPEG?w=1007&h=800",
          ),
          ProductWidget(
            "macMini4",
            "macMini4详细描述",
            "https://q4.itc.cn/q_70/images03/20241030/8909a9798b5d47b5bb7c84bf34a26afd.jpeg",
 ),
        ],
      ),
    );
  }
}

class ProductWidget extends StatelessWidget {
  final String title;
  final String desc;
  final String imageURL;
  ProductWidget(this.title, this.desc, this.imageURL);
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(20),
      decoration: BoxDecoration(border: Border.all()),
      child: Column(
        children: <Widget>[
          Text(title, style: TextStyle(fontSize: 24)),
          Text(desc, style: TextStyle(fontSize: 18)),
          SizedBox(height: 20,),
          Image.network(imageURL),
        ],
      ),
    );
  }
}
